<form nz-form #validateForm="ngForm"    (ngSubmit)="submitForm()" nzLayout="horizontal" autocomplete="off">
    <!-- 模态框头部 -->
    <div class="modal-header">
        <div class="modal-title">
            <i class="iconfont icon-medicine-box mr-sm"></i>
            <span *ngIf="entity.id">{{l('Edit')}}</span>
            <span *ngIf="!entity.id">{{l('Create')}}</span>
        </div>
    </div>
    <!-- 模态框内容 -->
    <fieldset>
        <!-- 提示信息 -->
        <!-- <nz-alert nzType="info" nzCloseable [nzShowIcon]="true" nzMessage="l('我想提示点什么内容给你说')"></nz-alert> -->
        <!-- CategoryId : CategoryId 的控件范围=Start= -->
        <nz-form-item nz-row>
            <nz-form-label nz-col [nzSm]="6" [nzXs]="24" nzRequired nzFor="categoryId">
                {{l('StockCategoryNames')}}
            </nz-form-label>
            <nz-form-control nz-col [nzSm]="14" [nzXs]="24" nzHasFeedback>
                <!--  控件位置 -->
                <nz-select name="categoryId" #categoryId="ngModel" [nzPlaceHolder]="l('StockCategoryInputDesc')"
                    required [(ngModel)]="entity.categoryId">
                    <!-- 请配置你的数据源 -->
                    <nz-option *ngFor="let option of categoryList" [nzValue]="option.value" [nzLabel]="option.text">
                    </nz-option>
                </nz-select>
                <!-- 校验 -->
                <nz-form-explain *ngIf="categoryId.control.dirty&&categoryId.control.errors">
                    <ng-container *ngIf="categoryId.control.hasError('required')">{{l('ThisFieldIsRequired')}}
                    </ng-container>
                </nz-form-explain>
            </nz-form-control>
        </nz-form-item>
        <!--CategoryId : CategoryId 的控件范围结束=END= -->
        <!-- Title : Title 的控件范围=Start= -->
        <nz-form-item nz-row>
            <nz-form-label nz-col [nzSm]="6" [nzXs]="24" nzRequired nzFor="title">
                {{l('Title')}}
            </nz-form-label>
            <nz-form-control nz-col [nzSm]="14" [nzXs]="24" nzHasFeedback>
                <!--  控件位置 -->
                <input nz-input name="title" #title="ngModel" [(ngModel)]="entity.title"
                    [placeholder]="l('StockTitleInputDesc')" required>

                <!-- 校验 -->
                <nz-form-explain *ngIf="title.control.dirty
                                                 &&title.control.errors">
                    <ng-container *ngIf="title.control.hasError('required')">{{l('ThisFieldIsRequired')}}</ng-container>
                </nz-form-explain>

            </nz-form-control>

        </nz-form-item>
        <!--Title : Title 的控件范围结束=END= -->
        <!-- Type : Type 的控件范围=Start= -->
        <nz-form-item nz-row>
            <nz-form-label nz-col [nzSm]="6" [nzXs]="24" nzRequired nzFor="type">
                {{l('Type')}}
            </nz-form-label>
            <nz-form-control nz-col [nzSm]="14" [nzXs]="24" nzHasFeedback>
                <!--  控件位置 -->
                <nz-select name="type" #type="ngModel" [nzPlaceHolder]="l('StockCategoryCollegeIdInputDesc')"
                    required [(ngModel)]="entity.type"
                    (ngModelChange)="set_type()">
                    <!-- 请配置你的数据源 -->
                    <nz-option *ngFor="let option of typeList" [nzValue]="option.value" [nzLabel]="option.text">
                    </nz-option>
                </nz-select>
                <!-- 校验 -->
                <nz-form-explain *ngIf="type.control.dirty&&type.control.errors">
                    <ng-container *ngIf="type.control.hasError('required')">{{l('ThisFieldIsRequired')}}
                    </ng-container>
                </nz-form-explain>
            </nz-form-control>
        </nz-form-item>
        <!--Type : Type 的控件范围结束=END= -->

         <!-- Limit : Limit 的控件范围=Start= -->
         <nz-form-item nz-row *ngIf="entity.type=='2'">
            <nz-form-label nz-col [nzSm]="6" [nzXs]="24" nzRequired nzFor="limit">
                {{l('Limit')}}
            </nz-form-label>
            <nz-form-control nz-col [nzSm]="14" [nzXs]="24" nzHasFeedback>
                <!--  控件位置 -->
                <nz-input-number name="limit" #limit="ngModel" [(ngModel)]="entity.limit" [nzMin]="0" [nzMax]="1000000"
                    [nzStep]="1"></nz-input-number>

                <!-- 校验 -->
                <nz-form-explain *ngIf="limit.control.dirty&&limit.control.errors">
                    <ng-container *ngIf="limit.control.hasError('required')">{{l('ThisFieldIsRequired')}}</ng-container>
                </nz-form-explain>
            </nz-form-control>

        </nz-form-item>
       
        <nz-form-item nz-row>
            <nz-form-label nz-col [nzSm]="6" [nzXs]="24" nzRequired nzFor="score">
                {{l('Score')}}
            </nz-form-label>
            <nz-form-control nz-col [nzSm]="14" [nzXs]="24" nzHasFeedback>
                <!--  控件位置 -->
                <nz-input-number name="score" #score="ngModel" [(ngModel)]="entity.score" [nzMin]="0" [nzMax]="1000000"
                    [nzStep]="0.1" [nzPlaceHolder]="'Digital'"></nz-input-number>

                <!-- 校验 -->
                <nz-form-explain *ngIf="score.control.dirty
                                                 &&score.control.errors">
                    <ng-container *ngIf="score.control.hasError('required')">{{l('ThisFieldIsRequired')}}</ng-container>
                </nz-form-explain>

            </nz-form-control>

        </nz-form-item>
        <!--Score : Score 的控件范围结束=END= -->
       
        <!-- Status : Status 的控件范围=Start= -->
        <nz-form-item nz-row>
            <nz-form-label nz-col [nzSm]="6" [nzXs]="24" nzRequired nzFor="Status">
                {{l('Status')}}
            </nz-form-label>
            <nz-form-control nz-col [nzSm]="14" [nzXs]="24" nzHasFeedback>
                <!--  控件位置 -->
                <nz-select name="Status" #status="ngModel" [nzPlaceHolder]="l('StockCategorystuInputDesc')"
                    required [(ngModel)]="entity.status">
                    <!-- 请配置你的数据源 -->
                    <nz-option *ngFor="let option of statusList" [nzValue]="option.value" [nzLabel]="option.text">
                    </nz-option>
                </nz-select>
                <!-- 校验 -->
                <nz-form-explain *ngIf="status.control.dirty&&status.control.errors">
                    <ng-container *ngIf="status.control.hasError('required')">{{l('ThisFieldIsRequired')}}
                    </ng-container>
                </nz-form-explain>
            </nz-form-control>
        </nz-form-item>
        <!--Status : Status 的控件范围结束=END= -->
         <!--Limit : Limit 的控件范围结束=END= -->
        <div  *ngIf="entity.type=='2' || entity.type=='1'">
            <div nz-row [nzGutter]="16" >
                <div nz-col class="gutter-row" [nzSpan]="6" [nzOffset]="6"><div class="inner-box">选项名称</div></div>
                <div nz-col class="gutter-row" [nzSpan]="6"><div class="inner-box">正确答案</div></div>
                <div nz-col class="gutter-row" [nzSpan]="6"><div class="inner-box">操作</div></div>
            </div>
    
            <nz-form-item *ngFor="let control of listOfControl; let i = index">
                <nz-form-control
                  [nzSm]="6"
                  nzErrorTip="不能为空"
                  [nzOffset]="6"
                >
                  <input
                    class="passenger-input"
                    nz-input
                    placeholder="选项内容"
                    [(ngModel)]="control.title"
                    [ngModelOptions]="{standalone: true}"
                  />
                </nz-form-control>
                <nz-form-control
                  [nzSm]="5"
                  nzErrorTip="不能为空"
                  [nzOffset]="1"
                >
                <label nz-checkbox [(ngModel)]="control.isRight"  [ngModelOptions]="{standalone: true}"  *ngIf="entity.type=='2'"></label>
                <!-- <label nz-radio  [(ngModel)]="control.isRight"  formControlName="isRight" *ngIf="entity.type!='2'"></label> -->
                <!-- <input type="radio" (ngValue)="true" [(ngModel)]="control.isRight" name="isRight" formControlName="isRight" *ngIf="entity.type!='2'"> -->
                <nz-radio-group [(ngModel)]="tModel" *ngIf="entity.type!='2'"   [ngModelOptions]="{standalone: true}" >
                    <label nz-radio [nzValue]="i" ></label>
                  </nz-radio-group>    
            </nz-form-control>
                <button (click)="removeField(control, $event)" class="ant-btn ant-btn-default">删除</button>
              </nz-form-item>
              <nz-form-item>
                <nz-form-control [nzSm]="{ offset: 12 }">
                  <button nz-button [nzType]="'primary'" (click)="addField($event)">
                    <i nz-icon nzType="plus"></i>
                    添加选项
                  </button>
                </nz-form-control>
              </nz-form-item>
        </div>

        <!-- Score : Score 的控件范围=Start= -->

    </fieldset>
    <!-- 模态框底部 -->
    <div class="modal-footer">
        <button nz-button [nzType]="'default'" type="button" (click)="close()" [disabled]="saving">
            <i class="iconfont icon-close-circle"></i> {{l("Cancel")}}
        </button>
        <button nz-button [nzType]="'primary'" type="submit" [disabled]="!validateForm.form.valid|| saving"
            [nzLoading]="saving">
            <i class="iconfont icon-save" *ngIf="!saving"></i> {{l("Save")}}
        </button>
    </div>
</form>
